package com.yidu.BusinessDealWith.controller;

import com.yidu.BusinessDealWith.entity.*;
import com.yidu.BusinessDealWith.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**@description: 庫存統計控制器
 *@author: 肖理
 *@create: 2022-09-10
 **/
@RestController
public class InventoryController {
    //調用Service
    @Autowired
    InventoryService inventoryService;

    /**
     * 库存统计
     * @param id 库存编号
     * @param dateTime 统计时间
     * @param request
     * @return
     */
    @RequestMapping("/selectInventory")
    public Map select(String id, String dateTime, HttpServletRequest request){
        System.out.println(id+" "+dateTime);
        HttpSession session = request.getSession();
        String fundId = (String) session.getAttribute("fundId");
        String userName = (String) session.getAttribute("userName");
        Map map =new HashMap();
        List<InventoryEntity> inventoryEntityList = inventoryService.select(id,fundId,dateTime,userName);
        map.put("code","0");
        map.put("msg","");
        map.put("count",200);
        map.put("data",inventoryEntityList);
        return map;
    }

}
